@extends('layouts.app')

@section('title', '官网内容编辑')

@section('css-import')
<style type="text/css">
.form-input-control{
	margin-bottom: 20px;
}
.loadCardBackground{
	width: 350px;
	display: block;
	margin:15px;
}
.fancy-checkbox-re{
	display: inline-block;
}
.fancy-checkbox-paren{
	display: block;
    font-weight: normal;
}
.toutiaocontent,.searchshop{
		margin-bottom:20px;
	}
.loadCardBackground{
	width: 350px;
	display: block;
	margin:15px;
}
</style>
@endsection

@section('content-fluid')

<div class="panel">
	<div class="panel-heading">
		<h3 class="panel-title">官网内容编辑</h3>
	</div>
	<div class="panel-body">
		<form action="/system/official/edit" method="post" id="createIdPower">
			<label>logo</label>
			<img src="{{$url.$logo}}" class="imagehome1file loadCardBackground">
			<input type="file" name="logo" placeholder="">
			<br>
			<label>网站轮播</label>
			<img src="{{$url.$homeimgs['imagehome1']}}" class="imagehome1file loadCardBackground">
			<input type="file" name="imagehome1" placeholder="">
			<img src="{{$url.$homeimgs['imagehome2']}}" class="imagehome2file loadCardBackground">
			<input type="file" name="imagehome2" placeholder="轮播">
			<br>
			<input type="text" name="propaganda" class="form-control" value="{{$propaganda}}" placeholder="首页宣传语">
			<br>
			<label>关于我们图片</label>
			<img src="{{$url.$aboutimg}}" class="aboutimgfile loadCardBackground">
			<input type="file" name="aboutimg" placeholder="">
			<br>
			<textarea name="aboutus" class="form-control form-input-control" placeholder="关于我们介绍" alt="关于我们介绍">{{$aboutus}}</textarea>
			<br>
			<div class="toutiao">
				<label class="control-label">文字轮播</label>
				<input type="text" name="model_toutiao" value="" class="form-control toutiaocontent copy_modemj hide" placeholder="名句名词" delmsg="false">
				<input type="text" name="model_toutiao" value="" class="form-control toutiaocontent copy_modemj2 hide" placeholder="作者" delmsg="false">
				@foreach($aboutming as $v)
				<input type="text" name="juzi[]" value="{{$v['juzi']}}" class="form-control toutiaocontent" placeholder="名句名词" delmsg="false">
				<input type="text" name="zuozhe[]" value="{{$v['zuozhe']}}" class="form-control toutiaocontent" placeholder="作者" delmsg="false">
				@endforeach
			</div>
			<div>
				<button type="button" class="btn btn-default inserttoutiao2" ><i class="fa fa-plus-square"></i>  添加</button>
			</div>
			<input type="hidden" name="admin_id" value="{{empty($_GET['admin_id'])?'':$_GET['admin_id']}}">
			<br>
			<label class="control-label">饭卡宣传</label>
			<img src="{{$url.$cardinfo['card1']['img']}}" class="loadCardBackground3 loadCardBackground">
			<input type="file" name="cardimg1">
			<input type="text" name="cardname1" class="form-control" placeholder="饭卡名称" value="{{$cardinfo['card1']['name'] ?? ''}}">
			<input type="text" name="cardprice1" class="form-control" placeholder="饭卡价格" value="{{$cardinfo['card1']['price'] ?? ''}}">
			<textarea name="aboutus1" class="form-control form-input-control" placeholder="饭卡介绍" alt="饭卡介绍">{{$cardinfo['card1']['info']}}</textarea>
			<img src="{{$url.$cardinfo['card2']['img']}}" class="loadCardBackground4 loadCardBackground">
			<input type="file" name="cardimg2">
			<input type="text" name="cardname2" class="form-control" placeholder="饭卡名称" value="{{$cardinfo['card2']['name'] ?? ''}}">
			<input type="text" name="cardprice2" class="form-control" placeholder="饭卡价格" value="{{$cardinfo['card2']['price'] ?? ''}}">
			<textarea name="aboutus2" class="form-control form-input-control" placeholder="饭卡介绍" alt="饭卡介绍">{{$cardinfo['card2']['info']}}</textarea>
			<img src="{{$url.$cardinfo['card3']['img']}}" class="loadCardBackground5 loadCardBackground">
			<input type="file" name="cardimg3">
			<input type="text" name="cardname3" class="form-control" placeholder="饭卡名称" value="{{$cardinfo['card3']['name'] ?? ''}}">
			<input type="text" name="cardprice3" class="form-control" placeholder="饭卡价格" value="{{$cardinfo['card3']['price'] ?? ''}}">
			<textarea name="aboutus3" class="form-control form-input-control" placeholder="饭卡介绍" alt="饭卡介绍">{{$cardinfo['card3']['info']}}</textarea>
			<img src="{{$url.$cardinfo['card4']['img']}}" class="loadCardBackground6 loadCardBackground">
			<input type="file" name="cardimg4">
			<input type="text" name="cardname4" class="form-control" placeholder="饭卡名称" value="{{$cardinfo['card4']['name'] ?? ''}}">
			<input type="text" name="cardprice4" class="form-control" placeholder="饭卡价格" value="{{$cardinfo['card4']['price'] ?? ''}}">
			<textarea name="aboutus4" class="form-control form-input-control" placeholder="饭卡介绍" alt="饭卡介绍">{{$cardinfo['card4']['info']}}</textarea>
			<img src="{{$url.$cardinfo['card5']['img']}}" class="loadCardBackground7 loadCardBackground">
			<input type="file" name="cardimg5">
			<input type="text" name="cardname5" class="form-control" placeholder="饭卡名称" value="{{$cardinfo['card5']['name'] ?? ''}}">
			<input type="text" name="cardprice5" class="form-control" placeholder="饭卡价格"value="{{$cardinfo['card5']['price'] ?? ''}}">
			<textarea name="aboutus5" class="form-control form-input-control" placeholder="饭卡介绍" alt="饭卡介绍">{{$cardinfo['card5']['info']}}</textarea>
			<img src="{{$url.$cardinfo['card6']['img']}}" class="loadCardBackground8 loadCardBackground">
			<input type="file" name="cardimg6">
			<input type="text" name="cardname6" class="form-control" placeholder="饭卡名称" value="{{$cardinfo['card6']['name'] ?? ''}}">
			<input type="text" name="cardprice6" class="form-control" placeholder="饭卡价格"value="{{$cardinfo['card6']['price'] ?? ''}}">
			<textarea name="aboutus6" class="form-control form-input-control" placeholder="饭卡介绍" alt="饭卡介绍">{{$cardinfo['card6']['info']}}</textarea>
			<br>
			<label class="control-label">附近餐店</label>
			<textarea name="pecial1" class="form-control form-input-control" placeholder="特色介绍附近餐店" alt="饭卡介绍">{{$cardspecial['pecial1']}}</textarea>
			<label class="control-label">随心选择</label>
			<textarea name="pecial2" class="form-control form-input-control" placeholder="特色介绍随心选择" alt="饭卡介绍">{{$cardspecial['pecial2']}}</textarea>
			<label class="control-label">便利实惠</label>
			<textarea name="pecial3" class="form-control form-input-control" placeholder="特色介绍便利实惠" alt="饭卡介绍">{{$cardspecial['pecial3']}}</textarea>
			<label class="control-label">品类繁多</label>
			<textarea name="pecial4" class="form-control form-input-control" placeholder="特色介绍品类繁多" alt="饭卡介绍">{{$cardspecial['pecial4']}}</textarea>
			<br>
			<label class="control-label">省域合伙人</label>
			<textarea name="provincemen" class="form-control form-input-control" placeholder="省域代理" alt="饭卡介绍">{{$joinin['provincemen']}}</textarea>
			<label class="control-label">市级合伙人</label>
			<textarea name="citymen" class="form-control form-input-control" placeholder="市级合伙人" alt="饭卡介绍">{{$joinin['citymen']}}</textarea>
			<label class="control-label">县级合伙人</label>
			<textarea name="areamen" class="form-control form-input-control" placeholder="县级合伙人" alt="饭卡介绍">{{$joinin['areamen']}}</textarea>
			
			<br><br>
			<div class="row">
				<div class="col-md-2">
					<button type="submit" class="btn btn-success btn-block">确认修改</button>
				</div>
			</div>
		</form>
	</div>
</div>
@endsection

@section('js-import')
<script type="text/javascript" src="{{config('app.inlet_src')}}/a/js/design.js"></script>
<script type="text/javascript" src="{{config('app.inlet_src')}}/a/js/homeediting.js"></script>
@endsection

@section('js-write')
<script type="text/javascript">
	var CouponSendParam = {
	    'dataType':'json',
	    'beforeSubmit':CouponBefore,
	    'success':CouponResponse,
	    'error':toutiaoError,
	};
	function CouponBefore(formData, jqForm, options){
	    
	}
	function CouponResponse(response) {
	    if(response.success){
	        setTimeout(function(){
	            location.href = '';
	        },2000);
	        toastr.success(response.message);
	    }else{
	        toastr.error('修改失败，请联系开发人员！');
	    }
	}

	function toutiaoError(XMLHttpRequest, textStatus, errorThrown) {
		if(XMLHttpRequest.status==422){
			var RegError = XMLHttpRequest.responseJSON.errors;
			for(var o in RegError){
				for (var i = 0; i < RegError[o].length; i++) {
					toastr.error(RegError[o][i]);
				}
			}
		}
	}
	ajaxForm_('#createIdPower', CouponSendParam);
</script>
@endsection